﻿<UserControl x:Class="Renci.Wwt.DataManager.Views.FilterListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:commands="clr-namespace:Renci.Wwt.DataManager.Common.Behaviours;assembly=Renci.Wwt.DataManager.Common"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style x:Key="CollectionEditorButtonStyle" TargetType="{x:Type Button}">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Opacity" Value="0.6" />
                </Trigger>
            </Style.Triggers>
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Height" Value="26" />
            <Setter Property="Width" Value="26" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Border Background="White"  BorderBrush="Black"  BorderThickness="0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ListBox Margin="3,3,0,3" 
                         commands:Selected.Command="{Binding SelectFilterCommand}"
                         Name="FiltersList" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock 
                                Text="{Binding Name}" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <StackPanel Margin="7,3,7,0" VerticalAlignment="Top" HorizontalAlignment="Center" Grid.Column="1">
                    <Button Style="{StaticResource CollectionEditorButtonStyle}"
                                            Command="{Binding MoveUpFilterCommand}" CommandParameter="{Binding SelectedValue, ElementName=FiltersList}">
                        <Path Fill="#FF404040" Data="F0 M 6,0 L 12,7 8,7 8,12 4,12 4,7 0,7 Z" />
                    </Button>
                    <Button Margin="0,1,0,0" Style="{StaticResource CollectionEditorButtonStyle}"
                                            Command="{Binding MoveDownFilterCommand}" CommandParameter="{Binding SelectedValue, ElementName=FiltersList}">
                        <Path Fill="#FF404040" Data="F0 M 4,0 L 8,0 8,5 12,5 6,12 0,5 4,5 Z" />
                    </Button>
                    <Button Margin="0,7,0,0" Style="{StaticResource CollectionEditorButtonStyle}"
                                            Command="{Binding DeleteFilterCommand}" CommandParameter="{Binding SelectedValue, ElementName=FiltersList}">
                        <Image Stretch="None" Height="16" Width="16" Margin="1" Source="/Renci.Wwt.DataManager;component/Resources/Images/delete.png" />
                    </Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
